package com.webmagic.webmagic.Scheduler;

import us.codecraft.webmagic.Request;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.scheduler.RedisScheduler;

/**
 * @author xbl
 * @Description
 * @date 2019/1/9
 */
public class MyRedisScheduler extends RedisScheduler {

    private boolean first = true;

    public MyRedisScheduler(String host) {
        super(host);
    }

    public MyRedisScheduler setFirst(boolean first) {
        this.first = first;
        return this;
    }

    @Override
    public boolean isDuplicate(Request request, Task task) {
        return !first&&super.isDuplicate(request, task);
    }

    @Override
    protected void pushWhenNoDuplicate(Request request, Task task) {
        super.pushWhenNoDuplicate(request, task);
    }
}
